package com.zxx.pattern.observerPattern.observable;

/**
 * @author zxx on 2021/3/9
 */
public class TestObservable {

    public static void main(String[] args) {
        Watched watched = new ConcreteWatched();

        Watcher watcher1 = new ConcreteWatcher();
        Watcher watcher2 = new ConcreteWatcher();
        Watcher watcher3 = new ConcreteWatcher();

        watched.addWatcher(watcher1);
        watched.addWatcher(watcher2);
        watched.addWatcher(watcher3);

        watched.notifyWatchers("哈哈哈");

        watched.removeWatcher(watcher2);
        watched.notifyWatchers("我才必有");
    }

}
